package mt.client;

import javax.swing.DefaultListModel;
import javax.swing.JPanel;

public class FilterThread extends Thread {
	
	private DefaultListModel<String> marketModel;
	
	public FilterThread(DefaultListModel<String> marketModel) {
		this.marketModel = marketModel;
	}

	@Override
	public void run(){
		while(!interrupted()){
			int er = -1;
			for(int i = 0; i < marketModel.getSize(); i++){
		String element = marketModel.get(i);
		
			for(int j = 0; j < marketModel.getSize(); j++){
				
				if( (marketModel.get(j).equals( marketModel.get(i)) && i !=j)){
					
				    er = i;
			
			}
			}
			try {
				sleep(20);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			}
			if(er > -1) marketModel.remove(er);
		}
		
	}

}
